Skip to content

Conversation

@njlie
Copy link
Contributor

@njlie njlie commented Jul 4, 2025

Changes proposed in this pull request

  • Adds a "Tenant" column to various tables in the Admin UI, when looking up tenanted resources.
  • Adds resolvers to GraphQL resolver schema that retrieves the tenant for the requested resource.

Context

Fixes RAF-1073.

Checklist

  • Related issues linked using fixes #number
  • Tests added/updated
  • Make sure that all checks pass
  • Bruno collection updated (if necessary)
  • Documentation issue created with user-docs label (if necessary)
  • OpenAPI specs updated (if necessary)

@github-actions github-actions bot added type: tests Testing related pkg: backend Changes in the backend package. pkg: frontend Changes in the frontend package. type: source Changes business logic pkg: mock-ase pkg: mock-account-service-lib labels Jul 4, 2025
@github-actions
Copy link

github-actions bot commented Jul 4, 2025

🚀 Performance Test Results

Test Configuration:

  • VUs: 4
  • Duration: 1m0s

Test Metrics:

  • Requests/s: 40.59
  • Iterations/s: 13.55
  • Failed Requests: 0.00% (0 of 2442)
📜 Logs

> [email protected] run-tests:testenv /home/runner/work/rafiki/rafiki/test/performance
> ./scripts/run-tests.sh -e test "-k" "-q" "--vus" "4" "--duration" "1m"

Cloud Nine GraphQL API is up: http://localhost:3101/graphql
Cloud Nine Wallet Address is up: http://localhost:3100/
Happy Life Bank Address is up: http://localhost:4100/
cloud-nine-wallet-test-backend already set
cloud-nine-wallet-test-auth already set
happy-life-bank-test-backend already set
happy-life-bank-test-auth already set
     data_received..................: 882 kB 15 kB/s
     data_sent......................: 1.9 MB 31 kB/s
     http_req_blocked...............: avg=7.5µs    min=2.39µs   med=5.55µs   max=2.02ms   p(90)=6.63µs   p(95)=7.16µs  
     http_req_connecting............: avg=379ns    min=0s       med=0s       max=414.39µs p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=97.85ms  min=7.67ms   med=79.03ms  max=631.24ms p(90)=172.49ms p(95)=191.48ms
       { expected_response:true }...: avg=97.85ms  min=7.67ms   med=79.03ms  max=631.24ms p(90)=172.49ms p(95)=191.48ms
     http_req_failed................: 0.00%  ✓ 0         ✗ 2442
     http_req_receiving.............: avg=96.3µs   min=29µs     med=81.23µs  max=2.84ms   p(90)=121.76µs p(95)=161.1µs 
     http_req_sending...............: avg=40.77µs  min=9.47µs   med=28.26µs  max=3.04ms   p(90)=40.81µs  p(95)=58.08µs 
     http_req_tls_handshaking.......: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=97.71ms  min=7.48ms   med=78.8ms   max=631.15ms p(90)=172.38ms p(95)=191.38ms
     http_reqs......................: 2442   40.58921/s
     iteration_duration.............: avg=294.92ms min=162.52ms med=280.02ms max=1.07s    p(90)=361.69ms p(95)=397.53ms
     iterations.....................: 815    13.546358/s
     vus............................: 4      min=4       max=4 
     vus_max........................: 4      min=4       max=4 

Base automatically changed from 2893/multi-tenancy-v1 to main July 6, 2025 12:35
@netlify
Copy link

netlify bot commented Jul 14, 2025

Deploy Preview for brilliant-pasca-3e80ec ready!

Name Link
🔨 Latest commit 96b2562
🔍 Latest deploy log https://app.netlify.com/projects/brilliant-pasca-3e80ec/deploys/691e1e3f58fdaf0008733eaf
😎 Deploy Preview https://deploy-preview-3495--brilliant-pasca-3e80ec.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added pkg: auth Changes in the GNAP auth package. type: localenv Local playground pkg: documentation Changes in the documentation package. and removed pkg: auth Changes in the GNAP auth package. type: localenv Local playground pkg: documentation Changes in the documentation package. labels Jul 14, 2025
@njlie njlie marked this pull request as ready for review July 15, 2025 21:15
njlie and others added 10 commits November 17, 2025 10:03
* feat(auth): tenants table v1

* fix: add updatedAt, createdAt

* feat: add deletedAt
* feat(auth): tenant service

* chore(auth): format

* fix(auth): jest test warning about migration

* fix(auth): remove temporary code

* feat(auth): soft delete tenants

* fix(auth): return erroneously removed tests
* feat(backend): tenant service

* fix: integration tests

* feat: use soft delete

* refactor: compare whole object in test

* fix: better gql errors in tests

* feat: add idp columns to tenant model

* feat: pagination tests, push deletedAt to auth api call

* feat: add cache

* fix: update localenv environment variables

* feat: make some tenants fields optional, small refactors
…3177)

* fix(backend): await signature verification

* test(integration): add signatures to apollo client requests

* test(backend): sign GraphQL requests in test environment

* Revert "test(backend): sign GraphQL requests in test environment"

This reverts commit 0a128d1.

* chore(backend): remove sig verification in test files
* feat(auth): tenants table v1

* feat(backend): tenant service

* feat: use soft delete

* feat: add idp columns to tenant model

* feat: pagination tests, push deletedAt to auth api call

* feat: add cache

* feat(backend): tenant signature validation for admin api

* fix: rebase errors

* fix: remove admin api secret check from app

* fix: always expect tenant id in request

* chore: remove some logs

* feat: await signature verification, test improvements

* fix: better util parameters

* fix: add tenant info to apollo context

* feat: fix integration tests

* fix: make tenant required on extended apollo context
* feat(auth): add service api with /healtz endpoint

* feat(auth): tenant routes

* feat(auth): service api error handling

* chore(auth): rm old todo

* fix(auth): how errors are set

* fix(auth): improve tenant tests, cleanup tenant get response,

* feat(backend): auth service api client

* fix(auth): change status codes to 204 where no body

* fix(backend): format

* feat(auth): add required deletedAt to DELETE /tenant body

* feat(backend): AUTH_SERVICE_API_URL env var

* fix(backend): auth service client tests to mock codes correctly

* feat(backend): add AuthServiceClient dep

* feat(backend): use auth service client in tenant service

* chore(auth): format

* chore(auth): format

* fix(integration,localenv): auth service api config

* fix(backend,auth): update tenant api to support deletedAt

* docs: update with env vars

* fix(backend): dep container type

* fix(localenv): docker compose config

* fix(backend): add default header to api client
* feat(backend): tenant service

* fix: integration tests

* feat: use soft delete

* refactor: compare whole object in test

* fix: better gql errors in tests

* feat: add idp columns to tenant model

* feat: pagination tests, push deletedAt to auth api call

* feat: add cache

* fix: update localenv environment variables

* feat(3114): add tenant to wallet address.

* feat(3114): test fixes.

* feat: make some tenants fields optional, small refactors

* feat(auth): tenants table v1

* feat(backend): tenant service

* feat: use soft delete

* feat: add idp columns to tenant model

* feat: pagination tests, push deletedAt to auth api call

* feat: add cache

* feat(backend): tenant signature validation for admin api

* fix: rebase errors

* feat(3114): update seed.ts

* fix: remove admin api secret check from app

* fix: always expect tenant id in request

* chore: remove some logs

* feat(3114): update for auth and resource server.

* feat(3114): fix asset service.test.ts

* feat(3114): fix tests.

* feat(3114): merged with latest tenant changes.

* feat(3114): extract tenant id from tenant context instead of admin input variable.

* feat(3114): test case updates, obtain tenant from header.

* feat(3114): fix test cases for wallet address.

* feat(3114): address review comments.

* feat(3114): rework tenantId to not be mandatory for wallet address service layer.

* feat(3114): rework tenantId to not be mandatory for wallet address service layer.

* feat(3114): rework tenantId to not be mandatory for wallet address service layer.

* feat(3114): fix tenant service test case.

* feat(3114): fix tenant service test case.

* feat(3114): fix tenant service test case.

* feat(3114): fix tenant service test case.

* feat(3114): fix tenant service test case.

* feat(3114): force 'forTenantId'.

* feat(3114): force 'forTenantId'.

* feat(3114): force 'forTenantId'.

* feat(3114): enhancements for 'forTenantId'.

* feat(3114): test case fixes.

* feat(3114): internal server error

* feat(3114): test case.

* feat(3114): test case.

* feat(3114): review feedback.

* feat(3114): review feedback.

* feat(3114): remove tenant on quote.

* feat(3114): default operator tenant.

* feat(3114): review feedback.

* feat(3114): review feedback from Max.

* feat(3114): review feedback from Max.

* feat(3114): fixed.

* feat(3114): review feedback.

* feat(3114): review feedback.

* feat(3114): review feedback. do not force error on graphql middleware.

* feat(3114): fix the integration test.

* feat(3114): further review comments.

* feat(3114): further review comments.

* feat(3114): final round with Max.

* feat(3114): revert.

* feat(3114): remove unused.

* feat(3114): set the correct operator id.

---------

Co-authored-by: Nathan Lie <[email protected]>
* feat: backend tenant graphql resolvers

* chore: formatting

* fix: extra testing db for tenants

* feat: bruno collection

* feat: update graphql schema comments

* fix: review comments

* feat: optional idp secret & consent url

* feat: tenant response requirement

* feat: make delete operator-only

* chore: cleanup
* feat(auth): tenanted grants

* fix: tests

* feat: update bruno collection

* fix: tests

* feat: update bruno requests, fix integration tests

* feat: handle tenants with no idp info

* feat: backfill tenants on grants, trim down queries

* feat: use tenantId in grant revocation

* fix: service function signatures
koekiebox and others added 20 commits November 17, 2025 16:37
* feat: backend tenant graphql resolvers

* chore: formatting

* fix: extra testing db for tenants

* feat: bruno collection

* feat: update graphql schema comments

* fix: review comments

* feat: optional idp secret & consent url

* feat: tenant response requirement

* feat: make delete operator-only

* feat(2915): admin front-end for tenant support

* feat(2915): apply permissions for tenant screens

* feat(2915): improvements

* chore: cleanup

* feat(2915): merged with tenant branch. updates to update screen.

* feat(2915): update fixes.

* feat(3180): bug fixes and testing with non operator tenant.

* feat(3180): bug fixes and testing with non operator tenant.

* feat(2915): review feedback

* feat(2915): fix update. field validation for email.

* feat(2915): formatting.

* feat(2915): fix.

* feat(2915): review fixes.

---------

Co-authored-by: Nathan Lie <[email protected]>
* feat(3256): able to view deleted tenant

* feat(3256): fix backend tests.

* feat(3256): allow for switching between deleted and not.

* feat(3256): review comments.
* Draft version of tenanted incoming payments

* Finished fixing unit and integration tests

* PR comments fixes

* Created helper function that adds tenantId to incoming payment id

* Removed tenantId from url in bruno requests, added tenantId in url of the incoming payment, fixed tests accordingly

* Fixed formatting

* Replaced get with findOne when querying using id and tenantId.
* feat: tenanted quotes - first iteration with dummy tenant

* feat: tenanted quotes - replace hardcoded tenantId values with creation of tenant

* feat: tenanted quotes - formatting

* feat: tenanted quotes - fix outgoing payments service test

* WIP

* Fix tests - TODOs not resolved yet

* feat: tenanted quotes and outgoing payments - update resolvers and fix all tests

* feat: tenanted quotes and outgoing payments - remove unnecessary comments

* feat: tenanted quotes and outgoing payments - fix integration tests

* feat: tenanted quotes and outgoing payments - fix vulnerabilities scan

* feat: tenanted quotes and outgoing payments - partially fix vulnerabilities scan

* feat: tenanted quotes and outgoing payments - fix get routes for quotes and outgoing payments

* feat: tenanted quotes and outgoing payments - fix outgoing payments routes unit tests

* chore: fix docker image scans (#3272)

* chore: fix path-to-regexp lib

* chore: update base node image version in Dockerfiles

---------

Co-authored-by: bsanduc <[email protected]>

* feat: tenanted quotes and outgoing payments - remove tenantId from ILP payment method handler

* feat: tenanted quotes and outgoing payments - remove tenantId from StartQuoteOptions in quote service

* feat: tenanted quotes and outgoing payments - fix unit tests

* feat: tenanted quotes and outgoing payments - remove tenantId from GraphQL Input types

* feat: tenanted quotes and outgoing payments - format

* feat: tenanted quotes and outgoing payments - remove tenantId from integration test inputs

* feat: tenanted quotes and outgoing payments - remove unnecessary tenantId

* feat: tenanted quotes and outgoing payments - update Bruno collection

* feat: tenanted quotes and outgoing payments - address PR comments

* feat: tenanted quotes and outgoing payments - fix Bruno collection merge conflict

* feat: tenanted quotes and outgoing payments - add tenantId to outgoing payments routes, add test cases for unknown tenantId

* feat: tenanted quotes and outgoing payments - update comments for GraphQL types

* feat: tenanted quotes and outgoing payments - update quote resolver context

* feat: tenanted quotes and outgoing payments - add tenantId to outgoing payment and quote routes middleware

* feat: tenanted quotes and outgoing payments - add test for getting outgoing payments WA middleware

* feat: tenanted quotes and outgoing payments - modify get outgoing payment query in service

* feat: tenanted quotes and outgoing payments - add test for getting WA from quote middleware

* feat: tenanted quotes and outgoing payments - remove unused import

* feat: tenanted quotes and outgoing payments - remove unused import

* feat: tenanted quotes and outgoing payments - format

---------

Co-authored-by: Max Kurapov <[email protected]>
* fix(tenant): duplicate test

* feat(tenants): settings

* feat(tenants): add default settings when creating tenant

* feat(tenantSettings): tests updates

* chore(tenantSettings): format

* chore(tenantSettings): format

* tests(tenantSettings): mock call to auth when creating tenant

* tests(tenants): when tenant is created, default settings should be set

* feat(graphql): tenant settings

* fix(tenantSettings): address PR comments
* feat(frontend): disallow api secret update and change tenant form to submit sections independently

* feat(backend): disallow tenant api secret update in admin api

* feat(backend): add service method to update secret, call on app start

* chore: rm log

* fix(fronted): 'no any' lint error

* fix(backend): error on failed secret update from config

* fix(backend): wallet address resolver tests to be operator/non-operator as needed

- previous way of controlling if the request was from an operator
or not no longer worked after changing
app start to sync apiSecret

* test(backend): update tenant tests to reflect operator cant update apiSecret

* chore: fix format

* chore: debug ci test failure (working locally)

* chore: fix format

* chore: debug ci test failure (working locally)

* chore: debug ci test failure (working locally)

* chore: debug ci test failure (working locally)

* chore: debug ci test failure (working locally)

* chore: debug ci test failure (working locally)

* chore: debug ci test failure (working locally)

* chore: debug ci test failure (working locally)

* chore: debug ci test failure (working locally)

* chore: debug ci test failure (working locally)

* chore: debug ci test failure (working locally)

* fix: test side effects

* fix(backend): uncomment test

* Update packages/backend/src/tenants/service.ts

Co-authored-by: Max Kurapov <[email protected]>

* fix(backend): rm unushesd nock

* feat(backend): set cache on update operator secret method

* fix(frontend): typo

* fix: typo

---------

Co-authored-by: Max Kurapov <[email protected]>
…3325)

* feat(graphql): schema update for specifying settings when creating tenant

* feat(tenant): add possibility to specify initial tenant settings as an operator

* test(tenant): create with settings

* feat(wallet-address): rename url to address

* fix(tenant-settings): duplicate key for tenant

* feat(wallet-address): replace url field with address field

url field was replaced with address field, because now with range in wallet address, it is possible
for the caller, to specify just the portion of the wallet address url. There is no need to specify
the whole url in order to create wallet address.

* chore(backend): format

* fix(tests): some of them

* fix(frontend): due to wallet address url change

* fix(mase): due to wallet address url change

* fix(backend): tests due to wallet address url change

* test(integration): fix tests and have default address for operator

* fix(wallet-address): test for operator can perform cross tenant create@

* test(tenant-settings): remove pagination tests for tenant settings

* docs(bruno): rename of the walletaddress url variable

* test(wallet-address): create with tenant settings or not as an operator or not

* feat(wallet-address): put creation of it into new function

* chore(format): everything

* feat(tenant-settings): add tests for upsert

* feat(tenant-settings): add more tests and remove pagination

* Update packages/backend/src/open_payments/wallet_address/service.ts

Co-authored-by: Max Kurapov <[email protected]>

* Update packages/backend/src/graphql/resolvers/tenant_settings.ts

Co-authored-by: Max Kurapov <[email protected]>

* Update packages/backend/src/graphql/schema.graphql

Co-authored-by: Max Kurapov <[email protected]>

* chore(graphql): generate schema

* fix(tenant): mapping settings to tenant

* chore(graphql): generate schema

---------

Co-authored-by: Max Kurapov <[email protected]>
…t is tenant (#3368)

* tests(tenants): when tenant is created, default settings should be set

* feat(graphql): tenant settings

* fix(tenantSettings): address PR comments

* fix(tenantSettings): address PR comments

* feat(backend): tenanted webhooks

* fix: rebase

* chore: fix some rebasing issues

* feat: add tenant id to tests; temporary operator tenant id in peer webhook events

* fix: build errors

* feat: remove temporary tenantId code from before tenanted peers

* fix: build errors

* tests(tenants): when tenant is created, default settings should be set

* fix(tenantSettings): address PR comments

* feat(backend): tenanted webhooks

* chore: fix some rebasing issues

* feat(backend): also publish webhooks to operators if primary recipient is tenant

* fix: rebase issues

* fix: tests

* feat: add webhook model

* refactor: move webhook & webhookevent models

* feat: include tenant id in webhook gql response

* fix: generated files

* fix: rebase errors

* feat: review comments

* feat: remove getWebhook, rename processWebhookEvent to processWebhook

* fix: remove operatorSettings from sendWebhook

---------

Co-authored-by: golobitch <[email protected]>
…ant by prefix (#3426)

* feat(backend): try to match 'wallet address not found' webhook to tenant by prefix

* fix: negative test for prefix matching

* fix: tests and withConfigOverride usage
* fix: bruno collection for open payments examples

* fix: bruno graphql resolvers

* fix: add tenant id to loadWalletAddressIdsIntoVariables for bruno collection
…SS tenantSetting (#3460)

* feat: add ILP_ADDRESS tenant setting, generate default one using tenant id

* chore: decouple incomingPayment from streamCredentialGeneration

* chore: generate StreamServer every time we get getStreamCredentials

* feat(backend): allowing passing in ilpAddress when generating stream credentials

* feat: adding paymentMethodProviderService

* feat: use paymentMethodProviderService in receiverService

* feat: use paymentMethodProviderService in incomingPayment service & model

* feat: use updated receiver structure to resolve ilp payment destination in ilpPaymentMethodService

* feat: use updated receiver structure in outgoingPaymentService

* chore: add paymentMethodProviderService to app init

* chore: update test files to use paymentMethodProviderService

* chore: lint

* test: use paymentMethodProviderService.getPaymentMethods during outgoingPayment creation

* chore(localenv): add ilpAddress for non-operator tenant for happy-life

* feat: update connector, peer service to determine & parse destination addresses

* fix: use correct redirect for tenanted mock-idp

* test(backend): adding test for longest prefix match for peer

* test(backend): add tests for stream-address middleware

* feat(backend): only set streamDestination & streamServer defined if valid tenantIlpAddress found

* chore(backend): remove unused part of account middleware

* chore(backend): add types to middleware

* test(backend): update stream-address middleware test

* test(backend): test fixes

---------

Co-authored-by: Nathan Lie <[email protected]>
@njlie njlie force-pushed the nl/3464/admin-ui-tenantid-column branch from 1bfc136 to 70f9df0 Compare November 18, 2025 21:52
@github-actions github-actions bot added pkg: auth Changes in the GNAP auth package. pkg: documentation Changes in the documentation package. labels Nov 18, 2025
@github-actions github-actions bot removed the pkg: auth Changes in the GNAP auth package. label Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: backend Changes in the backend package. pkg: documentation Changes in the documentation package. pkg: frontend Changes in the frontend package. pkg: mock-account-service-lib pkg: mock-ase type: source Changes business logic type: tests Testing related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants